package com.ipet.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ipet.web.pojo.Item;
import com.ipet.web.service.ItemService;

@Controller
@RequestMapping("/items")
public class itemController {
	@Autowired
	private ItemService itemService;
	
	@RequestMapping(value="/{itemId}",method=RequestMethod.GET)
	public String findItemById(@PathVariable Long itemId,Model model){
		Item item = itemService.findItemById(itemId);
		model.addAttribute("item", item);
		
		return "item";
	}
}
